(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0
length(cons(x, l)) → s(length(l))
ge(u, 0) → true
ge(0, s(v)) → false
ge(s(u), s(v)) → ge(u, v)
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
length(cons(x, l)) →+ s(length(l))
gives rise to a decreasing loop by considering the right hand sides subterm at position [0].
The pumping substitution is [l / cons(x, l)].
The result substitution is [ ].
(2) BOUNDS(n^1, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0'
length(cons(x, l)) → s(length(l))
ge(u, 0') → true
ge(0', s(v)) → false
ge(s(u), s(v)) → ge(u, v)
S is empty.
Rewrite Strategy: FULL
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
TRS:
Rules:
nthtail(n, l) → cond(ge(n, length(l)), n, l)
cond(true, n, l) → l
cond(false, n, l) → tail(nthtail(s(n), l))
tail(nil) → nil
tail(cons(x, l)) → l
length(nil) → 0'
length(cons(x, l)) → s(length(l))
ge(u, 0') → true
ge(0', s(v)) → false
ge(s(u), s(v)) → ge(u, v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
nthtail,
ge,
lengthThey will be analysed ascendingly in the following order:
ge < nthtail
length < nthtail
(8) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
The following defined symbols remain to be analysed:
ge, nthtail, length
They will be analysed ascendingly in the following order:
ge < nthtail
length < nthtail
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
ge(
gen_s:0'6_0(
n8_0),
gen_s:0'6_0(
n8_0)) →
true, rt ∈ Ω(1 + n8
0)
Induction Base:
ge(gen_s:0'6_0(0), gen_s:0'6_0(0)) →RΩ(1)
true
Induction Step:
ge(gen_s:0'6_0(+(n8_0, 1)), gen_s:0'6_0(+(n8_0, 1))) →RΩ(1)
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
The following defined symbols remain to be analysed:
length, nthtail
They will be analysed ascendingly in the following order:
length < nthtail
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
length(
gen_nil:cons5_0(
n283_0)) →
gen_s:0'6_0(
n283_0), rt ∈ Ω(1 + n283
0)
Induction Base:
length(gen_nil:cons5_0(0)) →RΩ(1)
0'
Induction Step:
length(gen_nil:cons5_0(+(n283_0, 1))) →RΩ(1)
s(length(gen_nil:cons5_0(n283_0))) →IH
s(gen_s:0'6_0(c284_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(13) Complex Obligation (BEST)
(14) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
length(gen_nil:cons5_0(n283_0)) → gen_s:0'6_0(n283_0), rt ∈ Ω(1 + n2830)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
The following defined symbols remain to be analysed:
nthtail
(15) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol nthtail.
(16) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
length(gen_nil:cons5_0(n283_0)) → gen_s:0'6_0(n283_0), rt ∈ Ω(1 + n2830)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
No more defined symbols left to analyse.
(17) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
(18) BOUNDS(n^1, INF)
(19) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
length(gen_nil:cons5_0(n283_0)) → gen_s:0'6_0(n283_0), rt ∈ Ω(1 + n2830)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
No more defined symbols left to analyse.
(20) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
(21) BOUNDS(n^1, INF)
(22) Obligation:
TRS:
Rules:
nthtail(
n,
l) →
cond(
ge(
n,
length(
l)),
n,
l)
cond(
true,
n,
l) →
lcond(
false,
n,
l) →
tail(
nthtail(
s(
n),
l))
tail(
nil) →
niltail(
cons(
x,
l)) →
llength(
nil) →
0'length(
cons(
x,
l)) →
s(
length(
l))
ge(
u,
0') →
truege(
0',
s(
v)) →
falsege(
s(
u),
s(
v)) →
ge(
u,
v)
Types:
nthtail :: s:0' → nil:cons → nil:cons
cond :: true:false → s:0' → nil:cons → nil:cons
ge :: s:0' → s:0' → true:false
length :: nil:cons → s:0'
true :: true:false
false :: true:false
tail :: nil:cons → nil:cons
s :: s:0' → s:0'
nil :: nil:cons
cons :: a → nil:cons → nil:cons
0' :: s:0'
hole_nil:cons1_0 :: nil:cons
hole_s:0'2_0 :: s:0'
hole_true:false3_0 :: true:false
hole_a4_0 :: a
gen_nil:cons5_0 :: Nat → nil:cons
gen_s:0'6_0 :: Nat → s:0'
Lemmas:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
Generator Equations:
gen_nil:cons5_0(0) ⇔ nil
gen_nil:cons5_0(+(x, 1)) ⇔ cons(hole_a4_0, gen_nil:cons5_0(x))
gen_s:0'6_0(0) ⇔ 0'
gen_s:0'6_0(+(x, 1)) ⇔ s(gen_s:0'6_0(x))
No more defined symbols left to analyse.
(23) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
ge(gen_s:0'6_0(n8_0), gen_s:0'6_0(n8_0)) → true, rt ∈ Ω(1 + n80)
(24) BOUNDS(n^1, INF)